package LuoGu;

import java.util.Scanner;

public class P1996 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] arr=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=i+1;
        }
        int len=arr.length;
        int index=0;
        while(len!=0){
            index--;
            index+=m;
            index%=len;
            System.out.print(arr[index]+" ");
            for(int i=index;i<len-1;i++){
                arr[i]=arr[i+1];
            }
            len--;
        }
    }
}
